// 专门封装用户相关的API
import request from '../utils/request'

// 注册接口
// obj{username,password,repassword}
// export function regAPI (obj) {
//   // 利用utils/request 发请求
//   return request.post('/api/reg', obj)
// }

export const regAPI = (obj) => request.post('/api/reg', obj)

/**
 * 登陆接口
 * @param {username, password} obj
 * @returns
 */
export const loginApi = (obj) => request.post('/api/login', obj)

export const getUserAPI = () => request.get('/my/userinfo')

export const getMenuAPI = () => request.get('/my/menus')

export const updateUserAPI = (obj) => request.put('/my/userinfo', obj)

export const avatarAPI = str => request.patch('/my/update/avatar', { avatar: str })

export const updatePwdAPI = obj => request.patch('/my/updatepwd', obj)
